<%@ page contentType="text/html; charset=utf-8" language="java"    pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>蛋糕后台</title>
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript">
		
			jQuery(function(){
			});
			
			function delComment(id){
				if (!confirm("确定这么做吗？")){
					return false;
			    }
				jQuery.post("delComment",{id:id,r:Math.random()},function(json){
					if(json.success==1){
						 alert('操作成功');
						 location.href="viewComments";
					}else{
						 alert('失败了，稍后重试');
					}
				},"json");
			}
		
		</script>
		<style type="text/css">
			<!--
			body,td,th {
				font-family: 宋体;
				font-size: 12px;
				color: #333333;
			}
			body {
				margin-left: 0px;
				margin-top: 0px;
			}
			-->
		</style>
    </head>
    <body>
        <table width="100%" border="1" style="margin-top: 50px;">
        	<tr>
        		<td bgcolor="#84FF84">蛋糕ID</td>
        		<td bgcolor="#84FF84">蛋糕名称</td>
        		<td bgcolor="#84FF84">评论标题</td>
        		<td bgcolor="#84FF84">评论内容</td>
        		<td bgcolor="#84FF84">评论IP</td>
        		<td bgcolor="#84FF84">评论时间</td>
        		<td bgcolor="#84FF84">操作</td>
        	</tr>
        	<c:forEach items="${comments }" var="comment">
	        	<tr>
	        		<td bgcolor="#84FF84">
	        			<c:if test="${comment.breadId eq 0 }">
	        				留言板留言
	        			</c:if>
	        			<c:if test="${comment.breadId ne 0 }">
		        			${comment.breadId}
	        			</c:if>
	        		</td>
	        		<td bgcolor="#84FF84">
	        			<c:if test="${empty comment.breadName}">
	        				留言板留言
	        			</c:if>
	        			<c:if test="${not empty comment.breadName}">
	        				${comment.breadName}	
	        			</c:if>
	        		</td>
	        		<td bgcolor="#84FF84">${comment.commentTitle }</td>
	        		<td bgcolor="#84FF84">${comment.commentContent }</td>
	        		<td bgcolor="#84FF84">${comment.ip }</td>
	        		<td bgcolor="#84FF84">${comment.createTime }</td>
	        		<td bgcolor="#84FF84"><a href="javascript:delComment('${comment.id }');">删除</a></td>
	        	</tr>
        	</c:forEach>
        	<tr>
	        		<td  align="center" colspan="10"><a href="admin_base">点此返回</a></td>
	        	</tr>
        </table>
    </body>
</html>
